package com.example.personalcenter;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 新闻列表项数据模型
 * 实现Parcelable接口以支持在Activity间传递
 */
public class NewsItem implements Parcelable {
    private String id;
    private String title;
    private String content;
    private String author;
    private String publishTime;

    public NewsItem(String id, String title, String content, String author, String publishTime) {
        this.id = id;
        this.title = title;
        this.content = content;
        this.author = author;
        this.publishTime = publishTime;
    }

    protected NewsItem(Parcel in) {
        id = in.readString();
        title = in.readString();
        content = in.readString();
        author = in.readString();
        publishTime = in.readString();
    }

    public static final Creator<NewsItem> CREATOR = new Creator<NewsItem>() {
        @Override
        public NewsItem createFromParcel(Parcel in) {
            return new NewsItem(in);
        }

        @Override
        public NewsItem[] newArray(int size) {
            return new NewsItem[size];
        }
    };

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getPublishTime() {
        return publishTime;
    }

    public void setPublishTime(String publishTime) {
        this.publishTime = publishTime;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(id);
        dest.writeString(title);
        dest.writeString(content);
        dest.writeString(author);
        dest.writeString(publishTime);
    }
}
